﻿using System;
using System.Collections.Generic;

namespace OMC.DataManagement
{
    /// <summary>
    /// This class represents a folder of the outlook inbox.
    /// </summary>
    [Serializable()]
    public class Folder
    {
        /// <summary>
        /// The Name of the Folder, its similar to the Folder in Outlook
        /// </summary>
        public string FolderName { get; set; }
        /// <summary>
        /// The entry id
        /// </summary>
        public string EntryID { get; set; }

        /// <summary>
        /// the extra info of the folder, like the entryID
        /// </summary>
        public string StoreID { get; set; }

        List<MailContent> mailList;

        /// <summary>
        /// The constructor.
        /// </summary>
        /// <param name="folderName">the name of the outlook mail folder</param>
        /// <param name="entryID">the entryId</param>
        /// <param name="storeID"></param>
        public Folder(String folderName, String entryID, String storeID)
        {
            this.FolderName = folderName;
            this.EntryID = entryID;
            this.StoreID = storeID;
            mailList = new List<MailContent>();
        }

        /// <summary>
        /// This method adds a mail item to the Maillist.
        /// </summary>
        /// <param name="body">The Body of the mail</param>
        /// <param name="subject">the subject of the mail</param>
        /// <param name="sender">the sender mail address of the mail</param>
        /// <param name="to">the receiver mail address of the mail</param>
        public void AddMailContent(String body, String subject, String sender, String to)
        {
            mailList.Add(new MailContent(body, subject, sender, to));
        }

        /// <summary>
        /// This enumerator gets the mailcontent of the items.
        /// </summary>
        /// <returns>elements</returns>
        public IEnumerator<MailContent> GetEnumerator()
        {
            foreach (MailContent mailContent in mailList)
            {
                yield return mailContent;
            }
        }
    }
}